<template>
    <div @click="toLogin">登录</div>
    <div>
        <button @click="changeName">改变名字</button>
        <p>名字：{{ store.name }}</p>
    </div>
</template>

<script lang="ts" setup>
import { useRouter } from "vue-router"
import {useStore} from '../store/index'

const store=useStore();
function changeName():void{
    store.name="xiaoyu"
}

const router = useRouter();
function toLogin() {
    router.push({ name: 'index' })
}

</script>